`
https://leetcode.cn/problems/flip-square-submatrix-vertically/
`

/**
 * @param {number[][]} grid
 * @param {number} x
 * @param {number} y
 * @param {number} k
 * @return {number[][]}
 */
var reverseSubmatrix = function (grid, x, y, k) {
  const m = grid.length
  const n = grid[0].length

  for (let i = y; i < y + k; i++) {
    let up = x, down = x + k - 1
    while (up < down) {
      ;[grid[up][i], grid[down][i]] = [grid[down][i], grid[up][i]]
      up++
      down--
    }
  }

  return grid
};